﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using CentaLine.Infrastructure;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace BI.DAL
{
    public class TestRepository
    {
        private static readonly Database _db = null;
        static TestRepository()
        {
            _db = DBHelper.CreateDataBase(); ;
        }

        public DataSet TestGetDataFromDB(string userName)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"SELECT TOP 1 
           [EmpNo]
          ,[empname]
          ,[positionname]
          ,[levels]
           FROM [CentaipRPT].[dbo].[BI_ROLE] WHERE EmpNo=@UserName");
            DbCommand cmd = _db.GetSqlStringCommand(strSql.ToString());
            _db.AddInParameter(cmd, "UserName", DbType.String, userName);
            return _db.ExecuteDataSet(cmd);
        }

    }
}
